#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int singleNumber(int* nums, int numsSize)
{
	int x = 1;
	int ret = 0;
	for (int j = 0; j <= 31; j++)
	{
		int count = 0;
		for (int i = 0; i < numsSize; i++)
		{
			x = 1;
			if ((nums[i] & (x <<= j)) != 0)
			{
				count++;
			}
		}
		if (count % 3 == 1)
		{
			x = 1;
			ret |= (x <<= j);
		}
	}
	return ret;
}

int main()
{
	int arr[] = {3,3,3,7,7,7,3,3,3,2,2,2,5};
	int sz = sizeof(arr) / sizeof(arr[0]);
	int ret = singleNumber(arr,sz);
	printf("%d", ret);
	return 0;
}